/*
============================================================================
 Name		: variasVentanasView.cpp
 Author	  : Ignacio Lopez
 Copyright   : GPL
 Description : CFindMe2ndViewGps implementation
============================================================================
*/

// INCLUDE FILES
#include  <aknviewappui.h>
#include  <avkon.hrh>
#include  <FindMe2nd.rsg>
#include  "FindMe2ndViewGps.h"
#include  "FindMe2ndContainerGps.h" 

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CFindMe2ndViewGps::ConstructL(const TRect& aRect)
// EPOC two-phased constructor
// ---------------------------------------------------------
//
void CFindMe2ndViewGps::ConstructL()
	{
	BaseConstructL( R_VIEW2 );
	iContainer = new (ELeave) CFindMe2ndContainerGps;
	iContainer->SetMopParent(this);
	iContainer->ConstructL( ClientRect() );
	}

// ---------------------------------------------------------
// CFindMe2ndViewGps::~CFindMe2ndViewGps()
// destructor
// ---------------------------------------------------------
//
CFindMe2ndViewGps::~CFindMe2ndViewGps()
	{
	if ( iContainer )
		{
		AppUi()->RemoveFromViewStack( *this, iContainer );
		delete iContainer;
		}

	
	}

// ---------------------------------------------------------
// TUid CFindMe2ndViewGps::Id()
//
// ---------------------------------------------------------
//
TUid CFindMe2ndViewGps::Id() const
	{
	return KView2Id;
	}

// ---------------------------------------------------------
// CFindMe2ndViewGps::HandleCommandL(TInt aCommand)
// takes care of view command handling
// ---------------------------------------------------------
//
void CFindMe2ndViewGps::HandleCommandL(TInt aCommand)
	{   
	switch ( aCommand )
		{
		case EAknSoftkeyOk:
			{
			iEikonEnv->InfoMsg( _L("view2 ok") );
			break;
			}
		case EAknSoftkeyBack:
			{
			AppUi()->HandleCommandL(EEikCmdExit);
			break;
			}
		default:
			{
			AppUi()->HandleCommandL( aCommand );
			break;
			}
		}
	}

// ---------------------------------------------------------
// CFindMe2ndViewGps::HandleClientRectChange()
// ---------------------------------------------------------
//
void CFindMe2ndViewGps::HandleClientRectChange()
	{
	if ( iContainer )
		{
		iContainer->SetRect( ClientRect() );
		}
	}

// ---------------------------------------------------------
// CFindMe2ndViewGps::DoActivateL(...)
// 
// ---------------------------------------------------------
//
void CFindMe2ndViewGps::DoActivateL(
	const TVwsViewId& /*aPrevViewId*/,TUid /*aCustomMessageId*/,
	const TDesC8& /*aCustomMessage*/)
	{
	if (!iContainer)
		{
		iContainer = new (ELeave) CFindMe2ndContainerGps;
		iContainer->SetMopParent(this);
		iContainer->ConstructL( ClientRect() );
		AppUi()->AddToStackL( *this, iContainer );
		}
	else
		{
		AppUi()->AddToStackL( *this, iContainer );
		iContainer->MakeVisible(ETrue);
		}
	}

// ---------------------------------------------------------
// CFindMe2ndViewGps::DoDeactivate()
// 
// ---------------------------------------------------------
//
void CFindMe2ndViewGps::DoDeactivate()
	{
	if ( iContainer )
		{
		AppUi()->RemoveFromViewStack( *this, iContainer );
		iContainer->MakeVisible(EFalse);
		}

	}

void CFindMe2ndViewGps::DisplayOnContainer(const enum TDisplaySection& aSection, const TDesC& aText) 
{
		iContainer->DisplayLabel(aSection,aText);
}

